<?php
/**
 * Created by PhpStorm.
 * User: 董坤鸿
 * Date: 2017/1/16
 * Time: 14:52
 */

require_once 'ModelTestCase.php';
use EWeiLink\JuPai\Services\MessageService;
class MessageTest extends ModelTestCase
{
    /**
     * 测试监听消息
     */
    public function testListen(){
        $clientId = '588464d85fa45e31f0002691';
        $plannerId = 1;
        $clientSecret = 'dlXdYI3Jnt65ZKAcCf5Vp49wTQSoDLg81JUWZiaS';
        $access_token = md5($clientId.$plannerId.$clientSecret);
        echo $access_token;die;
        $plannerId = 123;
        $time = 0;
        $message = new MessageService();
        $results = $message->listen($plannerId, $time);
        dd(json_encode($results, 128+256));
    }

    /**
     * 测试发发消息
     */
    public function testSend(){
        $plannerId = 2;  //理财师ID
        $content = '你好';    //消息内容
        $to = ['5884667217a8cf7f2d5fc131']; //联系人
        $type = 'text_msg'; //消息类型
        $message = new MessageService();
        $results = $message->send($plannerId, $content, $to, $type);
        dd($results);
    }
}